home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / ASTRNOMY / AA_51.ZIP / OEARTH.C < prev    next >
C/C++ Source or Header  |  1993-02-13  |  2KB  |  103 lines

  1. /* Orbital elements and perturbations for the earth
  2.  * Meeus, chapter 18
  3.  */
  4.  
  5. #include "kep.h"
  6.  
  7. extern double M, T;
  8.  
  9.  
  10. int oearth(e,J)
  11. struct orbit *e;
  12. double J;
  13. {
  14. double f;
  15.  
  16. e->epoch = J;
  17. T = (J - J1900)/36525.0; /* centuries from 1900.0 */
  18.  
  19. /* mean anomaly of the earth (and sun)
  20.  */
  21. f = (( -3.3e-6*T - 0.000150)*T + 35999.04975)*T + 358.47583;
  22. f = mod360(f);
  23. e->M = f;
  24. M = f;    /* save in global place */
  25.  
  26. /* eccentricity of the earth's orbit */
  27. e->ecc = (-0.000000126*T - 0.0000418)*T + 0.01675104;
  28.  
  29. /* semimajor axis */
  30. e->a = 1.0000002;
  31.  
  32. #if OFDATE
  33. /* epoch of equinox */
  34. e->equinox = J;
  35. /* inclination */
  36. e->i = 0.0;
  37. /* ascending node */
  38. e->W = 0.0;
  39. /* geometric mean longitude of the earth */
  40. f = (0.0003025*T + 36000.76892)*T + 99.69668; /*of sun: 279.69668*/
  41. e->L = mod360(f);
  42. /* Compute the argument of the perihelion from
  43.  * Mean anomaly = Mean longitude - Longitude of perihelion
  44.  */
  45. f = e->L - e->M;    /* arg perihelion */
  46. e->w = mod360(f);
  47. #else
  48. e->equinox = J2000;
  49. e->i = ((1.4e-8*T - 9.27e-6)*T + 0.0130855)*T - 0.0130762;
  50. f = ((3.333e-6*T + 0.00013610)*T + 0.5647920)*T + 287.511505;
  51. e->w = mod360(f);
  52. f = (( -2.8e-8*T + 7.94e-6)*T - 0.2416582)*T + 175.105679;
  53. e->W = mod360(f);
  54. f = e->w + e->M + e->W;
  55. e->L = mod360(f);
  56. #endif
  57. return(0);
  58. }
  59.  
  60.  
  61.  
  62.  
  63.  
  64. /* perturbations of the earth's orbit
  65.  * added in after solving Kepler's equation
  66.  */
  67.  
  68. int cearth(e)
  69. struct orbit *e;
  70. {
  71. double A, B, C, D, E, H, f;
  72. double sin(), cos();
  73.  
  74. /* perturbations due to Venus: */
  75. A = (22518.7541*T + 153.23)*DTR;
  76. B = (45037.5082*T + 216.57)*DTR;
  77. /* due to Jupiter: */
  78. C = (32964.3577*T + 312.69)*DTR;
  79. H = (65928.7155*T + 353.40)*DTR;
  80. /* due to the moon: */
  81. D = ((-0.00144*T + 445267.1142)*T + 350.74)*DTR;
  82. /* long period perturbation: */
  83. E = (20.20*T + 231.19)*DTR;
  84.  
  85. /* corrections to earth's longitude */
  86. f =   0.00134*cos(A)
  87.     + 0.00154*cos(B)
  88.     + 0.00200*cos(C)
  89.     + 0.00179*sin(D)
  90.     + 0.00178*sin(E);
  91. e->L += f*DTR;
  92.  
  93. /* corrections to earth's radius vector */
  94. f =   0.00000543*sin(A)
  95.     + 0.00001575*sin(B)
  96.     + 0.00001627*sin(C)
  97.     + 0.00003076*cos(D)
  98.     + 0.00000927*sin(H);
  99. e->r += f;
  100. return(0);
  101. }
  102.  
  103.